package com.hzw.saas.web.app.banner.controller;

import com.hzw.saas.api.banner.IBannerService;
import com.hzw.saas.api.banner.dto.BannerDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;

@RestController
@Api(tags = "banner信息")
public class BannerController {

    @Resource
    IBannerService bannerService;

    @GetMapping("banner/{clientType}")
    @ApiOperation(value = "获取banner信息", notes = "获取banner信息")
    @ApiImplicitParam(name = "clientType", value = "设备类型 可选值:'web-mobile', 'web-app'", dataType = "String", required = true)
    public ResponseEntity<BannerDto> getBanner(@PathVariable @NotBlank String clientType) {
        BannerDto bannerDto = bannerService.getBannerList(clientType);
        return ResponseEntity.ok(bannerDto);
    }
}
